<?php

require_once 'func_theme.php';
require_once 'func_panel.php';

add_action( 'after_setup_theme', 'igoogler_theme_setup' );
function igoogler_theme_setup() {

	global $content_width;

	if ( !isset( $content_width ) )
		$content_width = 600;

	add_theme_support( 'automatic-feed-links' );
	add_theme_support( 'post-thumbnails' );
	add_custom_background();
	add_editor_style('editor.css');

	add_action( 'init', 'igoogler_register_menus' );
	add_action( 'widgets_init', 'igoogler_register_sidebars' );
	add_action( 'template_redirect', 'igoogler_load_scripts' );
	
	igoogler_option_init();
	
	load_theme_textdomain('igoogler', get_template_directory() . '/languages');

	//Remove unused wp_head for SEO
	remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
	remove_action('wp_head','rsd_link');
	remove_action('wp_head','wlwmanifest_link');
	remove_action('wp_head','wp_generator');
	remove_action('wp_head', 'index_rel_link');
}

function igoogler_register_menus() {
	if (function_exists('register_nav_menus')){
		register_nav_menus( array(
				'menubar' => __('Top Menu', 'igoogler')
		) );
	}
}

function igoogler_register_sidebars() {
	if ( function_exists('register_sidebar') )
	{
		register_sidebar(array(
				'name' => __('Right Sidebar', 'igoogler'),
				'id' => 'right',
				'description' => __('Right column sidebar, maybe you could put latest comments, suggest readings or some ads here.', 'igoogler'),
				'before_widget' => '',
				'after_widget' => '',
				'before_title' => '<h3>',
				'after_title' => '</h3>',
		));
		register_sidebar(array(
				'name' => __('Left Sidebar', 'igoogler'),
				'id' => 'left',
				'description' => __('Right column sidebar, maybe you could put latest comments, suggest readings or some ads here.', 'igoogler'),
				'before_widget' => '',
				'after_widget' => '</div>',
				'before_title' => '<h3 class="lbar_title"><a>',
				'after_title' => '</a></h3><div class="lbar_content">',
		));
		register_sidebar(array(
				'name' => __('Bottom Sidebar'),
				'id' => 'bottom',
				'description' => __('The sidebar under single post, if you wish, you\'d better not change it.'),
				'before_widget' => '',
				'after_widget' => '',
				'before_title' => '<span>',
				'after_title' => '</span>',
		));
	}
}

function igoogler_load_scripts() {
	wp_deregister_script('l10n');
	wp_deregister_script( 'comment-reply' );
	
	wp_deregister_script( 'jquery' );
	wp_register_script( 'jquery', 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.0.min.js');
	wp_enqueue_script( 'jquery' );
}

?>
